/**
 * 格式化日期为指定格式
 * @param {Date|string} date - 日期对象或日期字符串
 * @returns {string} - 格式化后的日期字符串 (yyyy-MM-dd HH:mm:ss)
 */
export function formatDateTime(date) {
  if (!date) return ''
  
  const d = new Date(date)
  
  const year = d.getFullYear()
  const month = String(d.getMonth() + 1).padStart(2, '0')
  const day = String(d.getDate()).padStart(2, '0')
  const hours = String(d.getHours()).padStart(2, '0')
  const minutes = String(d.getMinutes()).padStart(2, '0')
  const seconds = String(d.getSeconds()).padStart(2, '0')
  
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
} 